package filters;

import java.io.IOException;
import java.util.Date;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import util.LoggerHelper;
import util.Util;

public class URLTracer implements Filter {
    
    public void doFilter (ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException{
       HttpServletRequest request = (HttpServletRequest) req;
       String uri = request.getRequestURI(); 
       
       //filtro contenido dinamico
       if(uri.endsWith("jsp")){
           String message = uri + " " + request.getMethod();
            LoggerHelper.loguearMensajeTracer( "tracer", message);
       }
       chain.doFilter(req, res);
    }

    public void init(FilterConfig fc) throws ServletException {
       
    }

    public void destroy() {
       
    }
}
